package cn.cdeden.knowledge.controller.docLog;

import cn.cdeden.common.core.domain.R;
import cn.cdeden.common.core.utils.page.TableDataInfo;
import cn.cdeden.knowledge.domain.dto.SysLogPermDto;
import cn.cdeden.knowledge.domain.dto.SysLogPermQueryParam;
import cn.cdeden.knowledge.service.SysLogPermService;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* @author GW
* @date 2024-01-19
**/
@RestController
@RequiredArgsConstructor
//@Api(tags = "权限日志管理")
@RequestMapping("/api/sysLogPerm")
public class SysLogPermController {

    private final SysLogPermService sysLogPermService;

//    @Log("查询权限日志")
//    @ApiOperation("查询权限日志")
    @GetMapping(value = "/query")
    public R<TableDataInfo<SysLogPermDto>> query(SysLogPermQueryParam query, Pageable pageable){
        TableDataInfo<SysLogPermDto> info = sysLogPermService.queryAll(query,pageable);
        return R.ok(info);
    }

////    @Log("新增权限日志")
////    @ApiOperation("新增权限日志")
//    @PostMapping(value = "/add")
//    public BaseRespResult create(@Validated @RequestBody SysLogPermDto resources){
//        return BaseRespResult.successResult(sysLogPermService.insert(resources));
//    }

//    @PutMapping
////    @Log("修改权限日志")
////    @ApiOperation("修改权限日志")
//    @PreAuthorize("@el.check('sysLogPerm:edit')")
//    public BaseRespResult update(@Validated @RequestBody SysLogPermDto resources){
//        return BaseRespResult.successResult(sysLogPermService.updateById(resources));
//    }
//
//    @DeleteMapping
////    @Log("删除权限日志")
////    @ApiOperation("删除权限日志")
//    @PreAuthorize("@el.check('sysLogPerm:del')")
//    public BaseRespResult delete(@RequestBody Set<Long> ids) {
//        return BaseRespResult.successResult(sysLogPermService.deleteByIds(ids));
//    }

    /*
//    @Log("导出权限日志")
//    @ApiOperation("导出权限日志")
    @GetMapping(value = "/download")
    @PreAuthorize("@el.check('sysLogPerm:list')")
    public void download(HttpServletResponse response, SysLogPermQueryParam query) throws IOException {
        sysLogPermService.download(sysLogPermService.queryAll(query), response);
    }*/

}
